var partnerid,usertype;
var SharePageMediator = Objs("view.SharePageMediator",
	Mediator,
{

	initialize: function( name, viewComponent )
	{ 
		SharePageMediator.$super.initialize.call( this, name, viewComponent );
		this.vproxy = this.facade.retrieveProxy( ProxyNames.VEHICLE_PROXY );
		this.registerListeners();
		
	},
	registerListeners: function()	
	{
		var sharePage = this.get();		
		sharePage.addEventListener( SharePage.SEND, this.send, this );	
	},
	send:function()
	{
	//if(anotheremaillink)
		this.vproxy.shareVehicle();
	},
	get: function()
	{
		return this.viewComponent;
	},

	
	listNotificationInterests: function()
	{
		return [
				NotificationNames.PARTNERLIST,
			
		];
	},
    handleNotification: function( note )
	{ 
		
		switch ( note.getName() )
		{ 
			case NotificationNames.PARTNERLIST:
			this.update(note.getBody());
			break;
		
		}
	},
	update:function(obj)
	{
		document.getElementById('to').options.length = 0;
		for(i=0;i<obj.partners.length;i++)
		{
			
			var partnersl=obj.partners[i].f_name+"("+obj.partners[i].email+")";
			var partnercombo = "<option value="+obj.partners[i].email+">"+partnersl+"</option>";
			$('select#to').append(partnercombo);
			$("select#to").trigger("change");
			partnerid=obj.partners[i].partner_id;
			usertype=obj.partners[i].user_type;
			

		}
	}

});

